package com.itheima.neibulei6;
/*
匿名内部类的使用场景
前提条件
现有一个接口
一个方法  需要这个接口
 */
public class Demo01 {
    public static void main(String[] args) {
        //调用下面的方法
       /* SwimmingImpl swimming = new SwimmingImpl();*/
        useSwimming(new Swimming(){
            @Override
            public void swim() {
                System.out.println("游什么游,看腿才是关键");
            }
        });
    }

    public static  void useSwimming(Swimming swim){// 父 父 = new 子();
        swim.swim();//只能是实现类.方法
    }

}
interface   Swimming{
    void swim();
}
/*
class  SwimmingImpl implements Swimming{
    @Override
    public void swim() {
        System.out.println("铁汁,我们去游泳吧");
    }
}*/
